#if !defined(_DESCRIPTORS_REPOSITORY_H)
#define _DESCRIPTORS_REPOSITORY_H

#include "alias.h"
#include "Command.h"
#include "SPluginException.h"
#include "SEnumTypeDescriptor.h"
#include "SVectorTypeDescriptor.h"
#include "SStructTypeDescriptor.h"

CREATE_ALIAS( DescriptorsRepository );

/**
 * Singleton class used to store all the type descriptors loaded.
 * Command names and type names must be fully qualified.
 */
class DECLARATION_DLL DescriptorsRepository
{

private:

	/** Reference to the single instance */
	static DescriptorsRepositorySp descriptorsRepository;

	/** Map use to store all the type descriptors */
	TypeDescriptorSpMap types;

	/** Map use to store all the command descriptors */
	CommandDescriptorSpMap commands;

	/** Private contructor to implement the Singleton pattern. */
	DescriptorsRepository()
	{	
	}

public:

	/**
	 * Get the only instance of the descriptors repository.
	 */
	static DescriptorsRepositorySp GetInstance();

	/**
	 * Returns true if a fully qualified command exist.
	 */
	bool ExistCommand(string commandName);

	/**
	 * Returns true if a fully qualified type exist.
	 */
	bool ExistType(string typeName);

	/**
	 * Get all the fully qualified command names.
	 */
	StringVectorSp GetCommandNames();

	/**
	 * Get all the fully qualified type names.
	 */
	StringVectorSp GetTypeNames();

	/**
	 * Get a command descriptor.
	 */
	CommandDescriptorSp GetCommandDescriptor(string commandName);

	/**
	 * Get a type descriptor
	 */
	TypeDescriptorSp GetTypeDescriptor(string typeName);

	/**
	 * Get an enum type descriptor.
	 */
	SEnumTypeDescriptorSp GetEnumTypeDescriptor(string typeName);

	/**
	 * Get a vector type descriptor.
	 */
	SVectorTypeDescriptorSp GetVectorTypeDescriptor(string typeName);

	/**
	 * Get a struct type descriptor.
	 */
	SStructTypeDescriptorSp GetStructTypeDescriptor(string typeName);

	/**
	 * Add a command descriptor.
	 */
	void AddCommandDescriptor(CommandDescriptorSp cd);

	/**
	 * Add a type descriptor.
	 */
	void AddTypeDescriptor(TypeDescriptorSp td);
};

#endif  